<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/20
 * Time: 0:13
 */
header('Content-Type:application/json');
include '../classes/logincheck.php';
include '../classes/conn.php';
if(islogin()!='teacher_login') {
    die('error');
}
$list=array();
$dir=opendir("../Files/".$_SESSION['t_num']."/namelist");
while (($file=readdir($dir))!=false){
    if($file!="."&&$file!=".."){
        $list[]=$file;
    }
}
$list=array("teacher"=>$_SESSION['t_num'],"files"=>$list);
$data=json_encode($list);
echo $data;
